import pandas as pd
import numpy as np

# 1.读取数据
path = "https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data"
name = ["Sample code number", "Clump Thickness", "Uniformity of Cell Size", "Uniformity of Cell Shape", "Marginal Adhesion", "Single Epithelial Cell Size", "Bare Nuclei", "Bland Chromatin", "Normal Nucleoli", "Mitoses", "Class"]
data = pd.read_csv(path, names=name)

# 2.将缺失值替换成 np.nan
# 1）替换
data_new = data.replace(to_replace="?", value=np.nan)
# 2）删除缺失值
data_new.dropna(inplace=True)

data_new.isnull().any() # 全部返回False说明不存在缺失值了